// @flow
import React from 'react'
import { Link } from 'react-router-dom'
import styles from './Wheel.css'

const arcs = [
  {
    title: '总览',
    id: 'overview',
    img: '/wheel/overview.png'
  },
  {
    title: '客户',
    id: 'customer',
    img: '/wheel/customer.png'
  },
  {
    title: '工况',
    id: 'condition',
    img: '/wheel/condition.png'
  },
  {
    title: '预警',
    id: 'service',
    img: '/wheel/service.png'
  },
  {
    title: '故障',
    id: 'malfunction',
    img: '/wheel/malfunction.png'
  },
  {
    title: '履历',
    id: 'resume',
    img: '/wheel/resume.png'
  },
  {
    title: 'BOM',
    id: 'bom',
    img: '/wheel/bom.png'
  },
  {
    title: '模型',
    id: 'model',
    img: '/wheel/module.png'
  }
]

type Props = {
  base: string,
  name: string
}

const Wheel = (props: Props) => (
  <div className={styles['wheel'] + ' ' + styles['closed']}>
    <ul>
      {
        arcs.map((arc, i) => {
          return <li key={i}>
            <Link to={`${props.base}/${arc.id}`} className={styles['content']}>
              <img src={arc.img} />
              <span style={{ display: 'block', textAlign: 'center' }}>
                {arc.title}
              </span>
            </Link>
          </li>
        })
      }
    </ul>
    <div className={styles['center']}>
      <img src='/wheel/wheel.png' />
      <span>{ props.name }</span>
    </div>
  </div>
)

export default Wheel
